package com.mylove.judas.yaya.mvp.model;

import com.mylove.judas.yaya.common.http.ParamPost;
import com.mylove.judas.yaya.common.rx.RxHttpResponseCompat;
import com.mylove.judas.yaya.common.rx.subscriber.ErrorHandlerSubscriber;
import com.mylove.judas.yaya.entity.BaseEntity;
import com.mylove.judas.yaya.retrofit.ServiceFactory;
import com.mylove.judas.yaya.retrofit.YaYaService;

import java.util.List;

/**
 * Created by Judas on 2018/4/25.
 */

public class ListModel {

    /**
     * 获取列表
     * @param params
     * @param subscriber
     */
    public void getAll(ParamPost params, ErrorHandlerSubscriber<List<BaseEntity>> subscriber){

        YaYaService yaYaService = ServiceFactory.createService(YaYaService.base_api, YaYaService.class);

        yaYaService.getAll(params.getParams())
                .compose(RxHttpResponseCompat.<List<BaseEntity>>compatResult())
                .subscribe(subscriber);

    }

}
